# 循环类型 1.for 2.while 3.嵌套循环

# while循环,循环的条件是一个判断条件
a = 0
while a < 10:
    if a % 2 == 0:
        print(a)
    elif a % 3 == 0:
        a += 1
        # 直接开始下一次循环
        continue
    elif a == 9:
        # 结束循环
        break
    else:
        # 空语句
        pass
    a += 1

# 循环使用 else 语句
b = 10
while b > 0:
    b -= 2
    print(b)
else:
    print("循环结束执行else")

# for循环,循环条件是一个列表、字符串、字典
string = "Python"
for s in string:
    print(s)

strList = ["1", "dasfas", 111, "你好"]
for list1 in strList:
    print(list1)

# 通过下标遍历
for index in range(len(strList)):
    print(strList[index])

# 遍历从0·len(listNum)每次index+2
listNum = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for index in range(0, len(listNum), 2):
    print(index)
